<html>
<head><meta charset="utf-8"><title>Fixing  #22590 · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Fixing.20.20.2322590.html">Fixing  #22590</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="155137843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Fixing%20%20%2322590/near/155137843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Fixing.20.20.2322590.html#155137843">(Jan 15 2019 at 01:58)</a>:</h4>
<p>Ever since I started using Rust, there's been this issue of bad error messages when a type doesn't implement a trait, but there are blanket impls for that trait which don't apply. This is documented in <a href="#22590" title="#22590">issue #22590</a>. You can see <a href="https://github.com/rust-lang/rust/issues/22590#issuecomment-454233522" target="_blank" title="https://github.com/rust-lang/rust/issues/22590#issuecomment-454233522">my latest comment on the issue</a> for an example, but I'll describe it here too:</p>
<p>Let's say there is a failing trait bound: <code>T: Foo</code>. If there are no blanket impls of <code>Foo</code>, the error message is <code>the trait bound `T: Foo` is not satisfied</code>. This is OK. It's maybe not the best error message ever, but it's not horrible.</p>
<p>But if there exists a blanket impl of <code>Foo</code> for <code>T</code> that has certain restrictions, let's say <code>T: Bar</code>. Then the error message will be <code>the trait bound `T: Bar` is not satisfied</code>, even the the real problem is that <code>T</code> does not implement <code>Foo</code>. This gets even more confusing if the blanket impl has a requirement like <code>T: 'static</code>, or an implicit <code>T: Sized</code>.</p>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  you suggested a better way to report these errors - starting with the "top-level" thing that failed. In this case it would be <code>T: Foo</code>, or perhaps the function call that the <code>T: Foo</code> obligation came from. Do you have any ideas about how that could be implemented?</p>



<a name="156720929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Fixing%20%20%2322590/near/156720929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mikeyhew <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Fixing.20.20.2322590.html#156720929">(Jan 23 2019 at 20:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you may not have gotten a notification when I posted this</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>